﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ProjectStorageLib.Configuration;

public partial class Administrator_ConfigureSettings : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Configuration conf = new Configuration();
            txbThreshold.Text = (from c in conf.ConfigurationSettings where c.Description == "Similarity Threshold" select c.Value).FirstOrDefault();
        }
    }

    protected void btnChangeClick(object sender, EventArgs e)
    {
        Configuration conf = new Configuration();
        var result = (from c in conf.ConfigurationSettings where c.Description == "Similarity Threshold" select c).FirstOrDefault();
        if (result==null)
        {
            conf.AddNewValue(txbThreshold.Text);
        }
        else
            conf.ChangeValue(result, txbThreshold.Text);
    }
}